//
//  TestTableViewHeader.m
//  Demo
//
//  Created by yc on 2017/11/13.
//  Copyright © 2017年 lc4y. All rights reserved.
//

#import "TestTableViewHeader.h"
#import "Masonry.h"
@implementation TestTableViewHeader

- (instancetype)init {
    if (self = [super init]) {
    }
    return self;
}

- (void)layoutSubviews {
    [super layoutSubviews];
    __weak typeof(self) weakself = self;
    [self.imageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.center.mas_equalTo(0);
        make.width.height.mas_equalTo(40);
    }];
    
    [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(weakself.imageView.mas_bottom).offset(10);
        make.centerX.mas_equalTo(0);
    }];
}


- (UIImageView *)imageView {
    if (!_imageView) {
        _imageView = [UIImageView new];
        _imageView.backgroundColor = [UIColor orangeColor];
        [self addSubview:_imageView];
    }
    return _imageView;
}

- (UILabel *)titleLabel {
    if (!_titleLabel) {
        _titleLabel = [UILabel new];
        _titleLabel.textAlignment = NSTextAlignmentCenter;
        _titleLabel.text = @"TableViewHeader";
        _titleLabel.textColor = [UIColor blackColor];
        [self addSubview:_titleLabel];
    }
    return _titleLabel;
}

@end
